home *** CD-ROM | disk | FTP | other *** search
- /*
- File: ProcessHelpers.h
-
- Contains: Functions to help you when you are working with processes.
-
- Written by: Andy Bachorski
-
- Copyright: Copyright © 1996-1999 by Apple Computer, Inc., All Rights Reserved.
-
- You may incorporate this Apple sample source code into your program(s) without
- restriction. This Apple sample source code has been provided "AS IS" and the
- responsibility for its operation is yours. You are not permitted to redistribute
- this Apple sample source code as "Apple sample source code" after having made
- changes. If you're going to re-distribute the source, we require that you make
- it clear in the source that the code was descended from Apple sample source
- code, but that you've made changes.
-
- Change History (most recent first):
- 7/21/1999 Karl Groethe Updated for Metrowerks Codewarror Pro 2.1
-
-
- */
-
- #if PRAGMA_ONCE
- #pragma once
- #endif
-
- #ifndef _PROCESS_HELPERS_
- #define _PROCESS_HELPERS_
-
-
- //******************************************************************************
-
- // A private conditionals file to setup the build environment for this project.
-
- #include "PrivateConditionals.h"
-
-
- //********** Universal Headers ****************************************
-
- #include <Processes.h>
- #include <Types.h>
-
-
-
- //******************************************************************************
-
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if PRAGMA_IMPORT
- #pragma import on
- #endif
-
- #if PRAGMA_STRUCT_ALIGN
- #pragma options align=mac68k
- #elif PRAGMA_STRUCT_PACKPUSH
- #pragma pack(push, 2)
- #elif PRAGMA_STRUCT_PACK
- #pragma pack(2)
- #endif
-
-
- //******************************************************************************
-
- pascal OSErr FindProcessBySignature( const OSType targetType,
- const OSType targetCreator,
- ProcessSerialNumberPtr psnPtr );
- /*
- Return a ProcessSerialNumber for a process whose signature (type and creator)
- matches the input values. This routine will find the first process that
- matches the type and creator.
-
- The ProcessSerialNumber will be kNoProcess is the requested process cannot
- be found.
-
- targetType input: The file type of the process to be found.
- targetCreator input: The creator type of the process to be found.
- psnPtr input: Pointer to a ProcessSerialNumber.
- output: A valid PSN or kNoProcess in no match is found.
-
- RESULT CODES
- ____________
- noErr 0 No error
- procNotFound –600 No process matched specified type and creator
- ____________
- */
-
- //******************************************************************************
-
- pascal OSErr GetProcessName( const ProcessSerialNumberPtr psnPtr,
- StringPtr processName );
- /*
- Returns the name of the process specified by ProcessSerialNumberPtr.
-
- The string pointed to by processName will be untouched if the process
- can't be found.
-
- psnPtr input: The process whose name you want.
- targetCreator input: The creator type of the process to be found.
- processName input: Pointer to a Str31 for the process name.
- output: The process name.
-
- RESULT CODES
- ____________
- noErr 0 No error
- paramErr –50 Process serial number is invalid
- ____________
- */
-
- //******************************************************************************
-
- pascal OSErr GetProcessTypeSignature( const ProcessSerialNumberPtr psnPtr,
- OSType *processType,
- OSType *processSignature );
- /*
- Returns the name of the process specified by ProcessSerialNumberPtr.
-
- processType and processSignature will be untouched if the process
- can't be found.
-
- psnPtr input: The process whose name you want.
- processType output: The process's type.
- processSignature output: The process's signature.
-
- RESULT CODES
- ____________
- noErr 0 No error
- paramErr –50 Process serial number is invalid
- ____________
- */
-
- //******************************************************************************
-
- pascal OSErr GetCurrentProcessFSSpec( FSSpec *spec );
- /*
- Returns the FSSpec for the process specified by ProcessSerialNumberPtr.
-
- spec output: The process's FSSpec.
-
- RESULT CODES
- ____________
- noErr 0 No error
- paramErr –50 Process serial number is invalid
- ____________
- */
-
- //******************************************************************************
-
- #if PRAGMA_STRUCT_ALIGN
- #pragma options align=reset
- #elif PRAGMA_STRUCT_PACKPUSH
- #pragma pack(pop)
- #elif PRAGMA_STRUCT_PACK
- #pragma pack()
- #endif
-
- #ifdef PRAGMA_IMPORT_OFF
- #pragma import off
- #elif PRAGMA_IMPORT
- #pragma import reset
- #endif
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif// _PROCESS_HELPERS_
-